#include <myheader.h>

/*Usage:  */
int main(int argc, char *argv[])
{
    const char *data = "i am a son";
    int pipefd[2];
    pipe(pipefd);
    if(fork() == 0){
        //子进程写
        close(pipefd[0]);
        printf("son is sleeping\n");
        sleep(5);
        write(pipefd[1],data,strlen(data));
        printf("son is under write construction\n");
    }else{
        //父进程读
        close(pipefd[1]);
        char buf[60] = {0};
        read(pipefd[0],buf,sizeof(buf));
        printf("father is under read construction\n");
        printf("%s\n",buf);
        wait(NULL);

    }
    return 0;
}

